package org.ala.tiktools.rpc.tcp.spring;

import org.ala.tiktools.rpc.spring.RpcBeanRegisterPostProcessor;
import org.ala.tiktools.rpc.tcp.config.RpcTcpConfigInfo;
import org.ala.tiktools.rpc.tcp.config.RpcTcpConfigInfoParser;
import org.springframework.core.annotation.AnnotationAttributes;
import org.springframework.core.type.AnnotationMetadata;


/**
 * @author ala
 * @date 2025-04-09 16:55
 */
public class TcpRpcBeanRegisterPostProcessor extends RpcBeanRegisterPostProcessor {
    @Override
    protected void beforeParse() {
        RpcTcpConfigInfoParser parser = new RpcTcpConfigInfoParser();
        RpcTcpConfigInfo.INSTANCE = parser.parseTcp(env);
    }

	@Override
	protected String[] pkgsFromAnnotation(AnnotationMetadata metadata) {
		AnnotationAttributes attributes = AnnotationAttributes.fromMap(metadata.getAnnotationAttributes(EnableAlaRpcTcp.class.getName()));
		return attributes.getStringArray("basePackages");
	}
	
}
